 var headerData={
	"header": [{
		"h1": "公司信息",
		"h2": [{
			"part": "公司简介"
		}, {
			"part": "公司团队"
		}, {
			"part": "企业文化"
		}, {
			"part": "公司新闻"
		}]
	}, {
		"h1": "业务体系",
		"h2": [{
			"part": "婚嫁平台"
		}, {
			"part": "婚嫁金融"
		}]
	},{
		"h1": "关于我们",
		"h2": [{
			"part": "加入我们"
		}, {
			"part": "联系我们"
		}]
	}]
};
 /*取值url的值*/
(function($) {
	$.getUrlParam = function(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if(r != null) {
			return unescape(r[2])
		}
		return null
	}
})(jQuery);
 /*渲染头部和脚步*/
 drawHeader(headerData);
function drawHeader(headerData) {
	/*头部渲染*/
	vueheader = new Vue({
		el: "#header-nav",
		data: {
			headNav: headerData,
			subUrl: "about-brief.html",
			footNav: headerData,
			navIndex: $.getUrlParam("index") ? $.getUrlParam("index") : 0,
			subIndex: $.getUrlParam("subindex") ? $.getUrlParam("subindex") : 0
		}
	});
	/*底部渲染*/
	vuefooder = new Vue({
		el: ".footer",
		data: {
			footNav:headerData,
			subUrl: "about-brief.html",
			subNav: headerData,
			navIndex: $.getUrlParam("index") ? $.getUrlParam("index") : 0,
			subIndex: $.getUrlParam("subindex") ? $.getUrlParam("subindex") : 0
		}
	})
}
/*移动端切换*/
$(".phone-btn").click(function() {
	$(".header-nav ul").slideToggle()
});
var serviceIP = "http://www.xhwed.com/";
var vueheader = null;
var vueslider = null;
var vuefooder = null;
var vuecontent = null;
/*判断有无本地缓存*/
//if(indexData) {
//	drawIndex(JSON.parse(indexData))
//} else {
//}
function drawIndex(datas) {
	/*内容渲染*/
	if($("#mod-con").length == 1) {
		vuecontent = new Vue({
			el: "#mod-con",
			data: {
				headNav: headerData,
				subUrl: "about-brief.html",
				navIndex: $.getUrlParam("index") ? $.getUrlParam("index") : 0,
				subIndex: $.getUrlParam("subindex") ? $.getUrlParam("subindex") : 0,
				navigation:datas.result.navigation,
				allcases: null,
				allNews: null
			},
			methods: {
				ifNews: function() {
					return this.navIndex == 0 && this.subIndex == 3
				}
			}
		})
	}
}
indexAjax();
function indexAjax() {
	if(sessionStorage.indexData){
		var datas=JSON.parse(sessionStorage.indexData);
		drawIndex(datas);
	}else{
		$.ajax({
			type: "post",
			url: serviceIP + "shemhe.php/Officials/index",
			async: true,
			dataType: "json",
			success: function(datas) {
				indexData = sessionStorage.indexData = JSON.stringify(datas);
				console.log(JSON.parse(indexData));
				drawIndex(datas)
			}
		})
	}
}


